package vip.huhailong.rabbitmqdemo.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

@Slf4j
public class ConfirmCallbackConfig implements RabbitTemplate.ConfirmCallback {

    /**
     *
     * @param correlationData 相关配置信息
     * @param b 交换机是否成功收到消息
     * @param s 错误消息
     */
    @Override
    public void confirm(CorrelationData correlationData, boolean b, String s) {
        log.info("发送消息成功");
        if(b){
            log.info("交换机成功收到消息");
        }else{
            log.error("错误信息:{}",s);
        }
    }
}
